DP19 最长公共子序列(一)
import java.util.Scanner;

 注意类名必须为 Main, 不要有任何 package xxx 信息
public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int m = in.nextInt();
        char[] s1 = in.next().toCharArray();
        char[] s2 = in.next().toCharArray();
        int[][] dp = new int[n+1][m+1];
        for (int i = 1; i = n; i++) {
            for (int j = 1; j = m; j++) {
                if (s1[i-1] == s2[j-1]) {
                    dp[i][j] = 1 + dp[i-1][j-1]; 
                } else {
                    dp[i][j] = Math.max(dp[i-1][j], dp[i][j-1]);
                }
            }
        }
        System.out.println(dp[n][m]);
    }
}